package com.example.designpatterns.creational.abstractFactory;

import com.example.designpatterns.creational.factory.Shape;

/**
 * @author zuitu@foxmail.com
 * @date 2024/1/19
 */
public class ColorFactory extends AbstractFactory {
    @Override
    public Color getColor(String color) {
        if (color == null) {
            return new NoColor();
        }
        if (color.equalsIgnoreCase("RED")) {
            return new Red();
        } else if (color.equalsIgnoreCase("GREEN")) {
            return new Green();
        } else if (color.equalsIgnoreCase("BLUE")) {
            return new Blue();
        }
        return new NoColor();
    }
}
